home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / gs24src.zip / GXTYPE1.H < prev    next >
C/C++ Source or Header  |  1992-03-15  |  3KB  |  99 lines

  1. /* Copyright (C) 1990, 1992 Aladdin Enterprises.  All rights reserved.
  2.    Distributed by Free Software Foundation, Inc.
  3.  
  4. This file is part of Ghostscript.
  5.  
  6. Ghostscript is distributed in the hope that it will be useful, but
  7. WITHOUT ANY WARRANTY.  No author or distributor accepts responsibility
  8. to anyone for the consequences of using it or for whether it serves any
  9. particular purpose or works at all, unless he says so in writing.  Refer
  10. to the Ghostscript General Public License for full details.
  11.  
  12. Everyone is granted permission to copy, modify and redistribute
  13. Ghostscript, but only under the conditions described in the Ghostscript
  14. General Public License.  A copy of this license is supposed to have been
  15. given to you along with Ghostscript so you can know your rights and
  16. responsibilities.  It should be in a file named COPYING.  Among other
  17. things, the copyright notice and this notice must be preserved on all
  18. copies.  */
  19.  
  20. /* gxtype1.h */
  21. /* Private Adobe Type 1 font definitions for GhostScript library */
  22. #include "gstype1.h"
  23.  
  24. /* Define the charstring command set */
  25. typedef enum {
  26.         c_undef0 = 0,
  27.     c_hstem = 1,
  28.         c_undef2 = 2,
  29.     c_vstem = 3,
  30.     c_vmoveto = 4,
  31.     c_rlineto = 5,
  32.     c_hlineto = 6,
  33.     c_vlineto = 7,
  34.     c_rrcurveto = 8,
  35.     c_closepath = 9,
  36.     c_callsubr = 10,
  37.     c_return = 11,
  38.     c_escape = 12,            /* extends the command set */
  39.     c_hsbw = 13,
  40.     c_endchar = 14,
  41.         c_undef15 = 15,
  42.         c_undef16 = 16,
  43.         c_undef17 = 17,
  44.         c_undef18 = 18,
  45.         c_undef19 = 19,
  46.         c_undef20 = 20,
  47.     c_rmoveto = 21,
  48.     c_hmoveto = 22,
  49.         c_undef23 = 23,
  50.         c_undef24 = 24,
  51.         c_undef25 = 25,
  52.         c_undef26 = 26,
  53.         c_undef27 = 27,
  54.         c_undef28 = 28,
  55.         c_undef29 = 29,
  56.     c_vhcurveto = 30,
  57.     c_hvcurveto = 31
  58. } char_command;
  59. typedef enum {                /* extended commands */
  60.     ce_dotsection = 0,
  61.     ce_vstem3 = 1,
  62.     ce_hstem3 = 2,
  63.     ce_seac = 6,
  64.     ce_sbw = 7,
  65.     ce_div = 12,
  66.     ce_undoc15 = 15,        /* Undocumented by Adobe, */
  67.                     /* but used in some Adobe fonts. */
  68.     ce_callothersubr = 16,
  69.     ce_pop = 17,
  70.     ce_setcurrentpoint = 33
  71. } char_extended_command;
  72.  
  73. /* Define the encoding of numbers */
  74. #define c_num1 32
  75. #define c_value_num1(ch) ((int)(byte)(ch) - 139)
  76. #define c_num2 247
  77. #define c_value_num2(c1,c2)\
  78.   (((int)(byte)((c1) - c_num2) << 8) + (int)(byte)(c2) + 108)
  79. #define c_num3 251
  80. #define c_value_num3(c1,c2)\
  81.   -(((int)(byte)((c1) - c_num3) << 8) + (int)(byte)(c2) + 108)
  82. /* Otherwise, the first byte is 255, followed by a 32-bit 2's complement */
  83. /* number in big-endian order. */
  84. #define c_num4 255
  85.  
  86. /* Define the encryption parameters */
  87. #define crypt_c1 ((ushort)52845)
  88. #define crypt_c2 ((ushort)22719)
  89. #define encrypt_next(ch, state, chvar)\
  90.   chvar = ((ch) ^ (state >> 8)),\
  91.   state = (chvar + state) * crypt_c1 + crypt_c2
  92. #define decrypt_this(ch, state)\
  93.   ((ch) ^ (state >> 8))
  94. #define decrypt_next(ch, state, chvar)\
  95.   chvar = decrypt_this(ch, state),\
  96.   decrypt_skip_next(ch, state)
  97. #define decrypt_skip_next(ch, state)\
  98.   state = ((ch) + state) * crypt_c1 + crypt_c2
  99.